import request from '@/utils/request'

/**
 * @description: 获取学科列表
 * @param {*} id {路径id}
 * @return {*}
 */
export function details ({ subjectName, page, pagesize }) {
  return request({
    method: 'get',
    url: '/subjects',
    params: {
      subjectName,
      page,
      pagesize
    }
  })
}

/**
 * @description: 学科添加
 * @param {*}
 * @return {*}
 */

export function addsubjectFn (data) {
  return request({
    method: 'POST',
    url: '/subjects',
    data
  })
}

/**
 * @description: 学科详情
 * @param {*}
 * @return {*}
 */
export function detailsFn (id) {
  return request({
    url: `/subjects/${id}`
  })
}
/**
 * @description: 学科修改
 * @param {*}
 * @return {*}
 */
export function modifyAPI ({ id, subjectName, isFrontDisplay }) {
  return request({
    method: 'PUT',
    url: `/subjects/${id}`,
    data: {
      id,
      subjectName,
      isFrontDisplay
    }
  })
}
/**
 * @description: 学科删除
 * @param {*}
 * @return {*}
 */
export function removeAPI (id) {
  return request({
    method: 'DELETE',
    url: `/subjects/${id}`
  })
}
